package com.example.yan_music.view.fragment;

import android.os.Bundle;

import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.RecyclerView;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.yan_music.R;
import com.example.yan_music.adapter.BannerImageAdapter;
import com.example.yan_music.adapter.RcvFavoriteAdapter;
import com.example.yan_music.base.fragment.BaseFragment;
import com.example.yan_music.db.table.FavoriteSong;
import com.example.yan_music.listener.OnRcvClickListener;
import com.youth.banner.Banner;

import java.util.ArrayList;
import java.util.List;

/**
 *  <p>
 *      收藏页面
 *      包含用户喜欢的歌曲
 *      功能：列表子项提供取消收藏
 *  </p>
 */
public class FavoriteFragment extends BaseFragment implements OnRcvClickListener , View.OnClickListener{

    private static final String TAG = "FavoriteFragment";
    private static final String TITLE = "收 藏";

    private RcvFavoriteAdapter mAdapter;
    private RecyclerView mRecyclerView;
    private ArrayList<FavoriteSong> mList = new ArrayList<>();
    private FavoriteSong mFavoriteSong;

    /**
     * 控件
     */
    private ImageView mImgBack;
    private TextView mTvTitle;
    private NestedScrollView scrollView;

    /**
     * 轮播图相关
     */
    private Banner banner;
    private BannerImageAdapter adapter;
    private List<com.example.yan_music.bean.wangyi.Banner.BannersBean> mBannerList;



    public FavoriteFragment() {

    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        final View view = inflater.inflate(R.layout.fragment_favorite, container, false);
        init(view);
        initBase();
        //iFavoritePresenterImp.getBanner();
        return view;
    };

    @Override
    public void init(View view) {

       // banner = view.findViewById(R.id.banner);
        mRecyclerView = view.findViewById(R.id.rcv_favorite);
        mImgBack = view.findViewById(R.id.action_back);
        mTvTitle = view.findViewById(R.id.tv_title);

        mImgBack.setOnClickListener(this);

    }

    private void initBase(){
        mTvTitle.setText(TITLE);
    }

    @Override
    public void onItemClick(View view, int position) {
        switch (view.getId()){
            default:
                break;
        }
    }



    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.action_back:
                //backToPrevious();
            default:
                break;
        }
    }
}